
package com.killcalorie.wjduan.controller


import com.killcalorie.wjduan.Message

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RequestMapping


// @RestController 
// class MessageController {

//     // http://localhost:8080?name=John

//     @GetMapping("/")
//     fun index(@RequestParam("name") name: String) =  "Hello, $name!"
// }



@RestController
@RequestMapping("/")
class MessageController {
    @GetMapping
    fun listMessages() = listOf(
        Message("1", "Hello!"),
        Message("2", "Bonjour!"),
        Message("3", "Privet!"),
    )
}